﻿using System.Numerics;
using System.Runtime.InteropServices;

namespace Xioa_UI.DataOrigin;

public class ValueTypeObjectAddress
{
    public static unsafe int PrintValueTypeObjectAddress()
    {
        Vector2 v1 = new Vector2();
        Vector2* pV1 = &v1;
        return (int)pV1;
    }

    public static unsafe string PrintReferenceTypeObjectAddress(object o)
    {
        GCHandle h = GCHandle.Alloc(o, GCHandleType.Pinned);
        IntPtr addr = h.AddrOfPinnedObject();
        return addr.ToString("X");
    }
}